package com.dong.policy.service.sakila;

import com.dong.policy.entity.mysql.sakila.Actor;
import com.dong.policy.service.dao.ActorMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class ActorService {
    private final ActorMapper actorMapper ;

    public ActorService(ActorMapper actorMapper) {
        this.actorMapper = actorMapper;
    }

    @Transactional(rollbackFor = Exception.class)
    public int update(Actor actor){
        int n = actorMapper.update(actor);
        if (n == 1){
            System.out.println("更新成功");
        }

        return n ;
    }
    public int add(Actor actor){
        int n = actorMapper.add(actor);
        if (n== 1){
            System.out.println("新增成功");
        }
        int m = 1 /0 ;
        return n  ;
    }
}
